import React from 'react';
import './index.less';
import {connect} from "dva";
import Curd from "components/Curd";
import createColumns from './columns';
import {searchColumns} from './searchColumns'


@connect(({device, hospital}) => ({device, hospital}))
export default class extends Curd {

  getNamespace() {
    return 'device';
  }

  getTableColumns() {
    return createColumns(this);
  }

  getSearchColumns() {
    return searchColumns;
  }

  getHospital = () => {


    const {all, loadingAll} = this.getModel("hospital");

    const dict = (!!all && all.length > 0) ? all.map(v => {
      return ({code: v.id, codeName: v.name})
    }) : undefined;

    return ({loading: loadingAll, dict});
  }
}
